package com.xja.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xja.mapper.ModelMapper;
import com.xja.model.entity.Model;
import com.xja.service.IModelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import static com.xja.constant.ModelType.*;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author caijg
 * @since 2025-06-08
 */
@Service
@Slf4j
public class ModelServiceImpl extends ServiceImpl<ModelMapper, Model> implements IModelService {

    @Override
    public Model getCurrentSimpleChatModel() {
        return this.getModelByType(CHAT_MODEL_TYPE);
    }

    @Override
    public Model getCurrentEvaluateModel() {
        return this.getModelByType(EVALUATE_MODEL_TYPE);
    }

    @Override
    public Model getcurrentTongueModel() {
        return this.getModelByType(TONGUE_MODEL_TYPE);
    }

    private Model getModelByType(Integer modelType) {
        return this.lambdaQuery()
                .eq(Model::getType, modelType)
                .one();
    }
}